package com.hetaoblog.util;


import java.util.List;
import java.util.Map;

import junit.framework.Assert;

import org.junit.Test;



public class HetaoBlogXssHtmlFilterTest {

	
	@Test
	public void testFilter2()
	{
		
		{
			String text = "<div class=\"red\" align=\"middle\"></div>";
			String out = HetaoBlogXssHTMLFilter.filter(text);
			System.out.println(out);
			
			
			Assert.assertTrue(text.equalsIgnoreCase(out));
		}
		
		{
			String text = "<span style=\"color:#e53333;\">abc</span><br />";
			String out = HetaoBlogXssHTMLFilter.filter(text);
			System.out.println(out);
			
			
			Assert.assertTrue(text.equalsIgnoreCase(out));
		}

		{
			String text = "<span style=\"color:#e53333;text-align:justify;text-align:right;\">abc</span><br />";
			String out = HetaoBlogXssHTMLFilter.filter(text);
			System.out.println(out);
			
			
			Assert.assertTrue(text.equalsIgnoreCase(out));
		}

		
		{
			String text = "<span style=\"color:#e53333;font-weight:bold;text-align:center;font-style:italic;margin-left:100px\">abc</span><br />";
			String out = HetaoBlogXssHTMLFilter.filter(text);
			System.out.println(out);
			
			
			Assert.assertTrue(text.equalsIgnoreCase(out));
		}

		
		{
			String text = "<span style=\"color:red;\">abc</span><br />";
			String out = HetaoBlogXssHTMLFilter.filter(text);
			System.out.println(out);
			
			
			Assert.assertFalse(text.equalsIgnoreCase(out));
		}
		
		
		
		
		//testnull();
	}
	
	@Test
	public void testparse()
	{
		String style = "\"color:#e53333;font-style:italic;text-decoration:underline;\"";
//		Map<String, String> map =  HTMLFilter.parseAttrValues(style);
//		if(null != map)
//		{
//			for(String key: map.keySet())
//			{
//				System.out.println(key + "," + map.get(key));
//			}
//		}
	}
	

}
